<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Print_syntaxtree.html">
<link rel="next" href="Subroutines.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Commands" rel="Chapter" href="Commands.html">
<link title="Declaration" rel="Chapter" href="Declaration.html">
<link title="Exceptions" rel="Chapter" href="Exceptions.html">
<link title="Expressions" rel="Chapter" href="Expressions.html">
<link title="Intermediate" rel="Chapter" href="Intermediate.html">
<link title="Lexer" rel="Chapter" href="Lexer.html">
<link title="Main" rel="Chapter" href="Main.html">
<link title="Parser" rel="Chapter" href="Parser.html">
<link title="Print" rel="Chapter" href="Print.html">
<link title="Print_syntaxtree" rel="Chapter" href="Print_syntaxtree.html">
<link title="Semantic" rel="Chapter" href="Semantic.html">
<link title="Subroutines" rel="Chapter" href="Subroutines.html">
<link title="Syntaxtree" rel="Chapter" href="Syntaxtree.html">
<link title="Target" rel="Chapter" href="Target.html"><title>Semantic</title>
</head>
<body>
<div class="navbar"><a href="Print_syntaxtree.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Subroutines.html">Next</a>
</div>
<center><h1>Module <a href="type_Semantic.html">Semantic</a></h1></center>
<br>
<pre><span class="keyword">module</span> Semantic: <code class="code">sig</code> <a href="Semantic.html">..</a> <code class="code">end</code></pre>Contains all the functions to perform a small semantic analisys, which means only type checking :) 
    To do this has been introduced the "Semantic Type" which simplify the check<br>
<hr width="100%">
<br>
Contains all the functions to perform a small semantic analisys, which means only type checking :) 
    To do this has been introduced the "Semantic Type" which simplify the check<br>
<pre><span class="keyword">val</span> <a name="VALgetType"></a><a href="code_VALSemantic.getType.html">getType</a> : <code class="type"><a href="Intermediate.html#TYPEelement">Intermediate.element</a> -> <a href="Intermediate.html#TYPEsType">Intermediate.sType</a></code></pre><div class="info">
Recovers the semantic type from an offset<br>
<b>Returns</b> The semantic type of t<br>
</div>
<div class="param_info"><code class="code">t</code> : The element from which recover the type</div>
<pre><span class="keyword">val</span> <a name="VALcheckAexp"></a><a href="code_VALSemantic.checkAexp.html">checkAexp</a> : <code class="type"><a href="Syntaxtree.html#TYPEaexp">Syntaxtree.aexp</a> -><br>       <a href="Intermediate.html#TYPEdec_table">Intermediate.dec_table</a> -> <a href="Intermediate.html#TYPEproc_table">Intermediate.proc_table</a> -> <a href="Intermediate.html#TYPEsType">Intermediate.sType</a></code></pre><div class="info">
Checks the Semantic types of the arithmetical expressions<br>
<b>Returns</b> The semantic type of ex<br>
</div>
<div class="param_info"><code class="code">ex</code> : The arithmetical expression to check</div>
<pre><span class="keyword">val</span> <a name="VALcheckParTypes"></a><a href="code_VALSemantic.checkParTypes.html">checkParTypes</a> : <code class="type"><a href="Syntaxtree.html#TYPEdec">Syntaxtree.dec</a> list -><br>       <a href="Syntaxtree.html#TYPEaexp">Syntaxtree.aexp</a> list -><br>       <a href="Intermediate.html#TYPEdec_table">Intermediate.dec_table</a> -> <a href="Intermediate.html#TYPEproc_table">Intermediate.proc_table</a> -> bool</code></pre><div class="info">
Checks the semantic type of a list of parameters<br>
<b>Returns</b> True if the formal parameters types match with the actual parameters type, False otherwise<br>
</div>
<div class="param_info"><code class="code">plist</code> : The list of formal parameters</div>
<div class="param_info"><code class="code">el</code> : The list of actual parameters</div>
<div class="param_info"><code class="code">dect</code> : The declarations table</div>
<div class="param_info"><code class="code">proct</code> : The procedures table</div>
<pre><span class="keyword">val</span> <a name="VALcheckBool"></a><a href="code_VALSemantic.checkBool.html">checkBool</a> : <code class="type"><a href="Syntaxtree.html#TYPEbexp">Syntaxtree.bexp</a> -><br>       <a href="Intermediate.html#TYPEdec_table">Intermediate.dec_table</a> -> <a href="Intermediate.html#TYPEproc_table">Intermediate.proc_table</a> -> <a href="Intermediate.html#TYPEsType">Intermediate.sType</a></code></pre><div class="info">
Checks the semantic type of boolean operations (compare is only allowed betrween int and int or float and float, 
    not mixed operations)<br>
<b>Returns</b> The sematic type of b<br>
</div>
<div class="param_info"><code class="code">b</code> : The boolean operation to check</div>
<div class="param_info"><code class="code">dect</code> : The declarations table</div>
<div class="param_info"><code class="code">proct</code> : The procedures table</div>
<pre><span class="keyword">val</span> <a name="VALcheckLexp"></a><a href="code_VALSemantic.checkLexp.html">checkLexp</a> : <code class="type"><a href="Syntaxtree.html#TYPElexp">Syntaxtree.lexp</a> -><br>       <a href="Intermediate.html#TYPEdec_table">Intermediate.dec_table</a> -> <a href="Intermediate.html#TYPEproc_table">Intermediate.proc_table</a> -> <a href="Intermediate.html#TYPEsType">Intermediate.sType</a></code></pre><div class="info">
Checks the semantic type of left expression<br>
<b>Returns</b> The semantic type of l<br>
</div>
<div class="param_info"><code class="code">l</code> : The left expression to check</div>
<div class="param_info"><code class="code">dect</code> : The declarations table</div>
<pre><span class="keyword">val</span> <a name="VALcmdsemantic"></a><a href="code_VALSemantic.cmdsemantic.html">cmdsemantic</a> : <code class="type"><a href="Syntaxtree.html#TYPEcmd">Syntaxtree.cmd</a> -> <a href="Intermediate.html#TYPEdec_table">Intermediate.dec_table</a> -> <a href="Intermediate.html#TYPEproc_table">Intermediate.proc_table</a> -> bool</code></pre><div class="info">
Checks the semantic type of commands<br>
<b>Returns</b> True of the command is well formed (type checking is good), Flase otherwise<br>
</div>
<div class="param_info"><code class="code">c</code> : The command to check</div>
<div class="param_info"><code class="code">dect</code> : The declarations table</div>
</body></html>